Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix qgis server fcgi response destructor #59632

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

benoitdm-oslandia
Copy link
Contributor

Suppress wait in fcgi response destructor

In the previous version, the response destructor waited for the monitoring thread to end that may induce a 333ms sleep each time. We fix that by using a classic ptr to separate the thread and the response lifecycles.

@benoitdm-oslandia benoitdm-oslandia self-assigned this Nov 28, 2024
@benoitdm-oslandia benoitdm-oslandia added the Server Related to QGIS server label Nov 28, 2024
@github-actions github-actions bot added this to the 3.42.0 milestone Nov 28, 2024
Copy link

github-actions bot commented Nov 28, 2024

🪟 Windows builds

Download Windows builds of this PR for testing.
Debug symbols for this build are available here.
(Built from commit babbfb0)

🪟 Windows Qt6 builds

Download Windows Qt6 builds of this PR for testing.
(Built from commit babbfb0)

@@ -45,11 +45,13 @@ class QgsSocketMonitoringThread: public QThread
* \param isResponseFinished
* \param feedback
*/
QgsSocketMonitoringThread( bool *isResponseFinished, QgsFeedback *feedback );
QgsSocketMonitoringThread( QgsFeedback *feedback );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about the feedback? Should it become a shared ptr now that lifetime is decoupled?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to check the side effects

src/server/qgsfcgiserverresponse.h Outdated Show resolved Hide resolved
@benoitdm-oslandia benoitdm-oslandia force-pushed the fix/fcgi_response_destructor branch from 97ebe44 to fc27b8d Compare November 28, 2024 15:11
@benoitdm-oslandia benoitdm-oslandia marked this pull request as draft November 29, 2024 13:43
@benoitdm-oslandia benoitdm-oslandia force-pushed the fix/fcgi_response_destructor branch from 1ec44a0 to 8a62b11 Compare December 6, 2024 07:47
@benoitdm-oslandia benoitdm-oslandia force-pushed the fix/fcgi_response_destructor branch from 8a62b11 to fcebbdc Compare December 6, 2024 16:18
for ( int i = 0; !mIsResponseFinished.load() && x2 == 0 && i < 10; i++ )
{
x2 = recv( mIpcFd, &c, 1, MSG_PEEK | MSG_DONTWAIT ); // see https://stackoverflow.com/a/12402596
std::this_thread::sleep_for( 50ms );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why waiting ? Is it require for synchronization?

Copy link
Contributor

@troopa81 troopa81 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer way much this solution that the one(s) before, thanks @benoitdm-oslandia 👍

Just a few comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Server Related to QGIS server
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants